package com.irun.ibuffet.ui;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;
import android.widget.Toast;

import com.irun.ibuffet.R;
import com.irun.ibuffet.utils.HttpUtils;
import com.irun.ibuffet.utils.RequestListener;
import com.irun.ibuffet.utils.RequestTask;

public class BuffetActivity extends Activity {

	private Context mContext;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main_layout);
		mContext = this;
		
		test();
	}
	
	private void test(){
		List<NameValuePair> params = new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair("mobile", "13348380634"));
		params.add(new BasicNameValuePair("password", "123456"));
		
		new RequestTask(null, Object.class, HttpUtils.METHOD_POST, new RequestListener() {
			@Override
			public void callback(boolean isSuc, Object data) {
				if(isSuc){
					((TextView) findViewById(R.id.logininfo)).setText(data.toString());
				}else{
					Toast.makeText(mContext, data.toString(), Toast.LENGTH_LONG).show();
				}
			}
		}).execute("http://192.168.1.102:81/Service1.asmx/SndJson");
	}

}
